<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
      <script>
              var arr =  [10,2,100,145];
              var p ;
              for(var i=1;i<arr.length;i++)
              {
                    for(var k =0;k<arr.length-1;k++ )
                    {
                       
                       if(arr[k]<arr[k+1])
                       {
                           p = arr[k];
                           arr[k]=arr[k+1];
                           arr[k+1] = p;
                       }
                    }
              }
      </script>
</body>
</html>

